package com.ruoyi.web.TemuSalesData.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.TemuSalesData.domain.TemuSalesData;
import com.ruoyi.web.TemuSalesData.service.ITemuSalesDataService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * TemuSalesDataController
 * 
 * @author kzc
 * @date 2025-07-26
 */
@RestController
@RequestMapping("/TemuSalesData/TemuSalesData")
public class TemuSalesDataController extends BaseController
{
    @Autowired
    private ITemuSalesDataService temuSalesDataService;

    /**
     * 查询TemuSalesData列表
     */
    @PreAuthorize("@ss.hasPermi('TemuSalesData:TemuSalesData:list')")
    @GetMapping("/list")
    public TableDataInfo list(TemuSalesData temuSalesData)
    {
        startPage();
        List<TemuSalesData> list = temuSalesDataService.selectTemuSalesDataList(temuSalesData);
        return getDataTable(list);
    }

    /**
     * 导出TemuSalesData列表
     */
    @PreAuthorize("@ss.hasPermi('TemuSalesData:TemuSalesData:export')")
    @Log(title = "TemuSalesData", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TemuSalesData temuSalesData)
    {
        List<TemuSalesData> list = temuSalesDataService.selectTemuSalesDataList(temuSalesData);
        ExcelUtil<TemuSalesData> util = new ExcelUtil<TemuSalesData>(TemuSalesData.class);
        util.exportExcel(response, list, "TemuSalesData数据");
    }

    /**
     * 获取TemuSalesData详细信息
     */
    @PreAuthorize("@ss.hasPermi('TemuSalesData:TemuSalesData:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(temuSalesDataService.selectTemuSalesDataById(id));
    }

    /**
     * 新增TemuSalesData
     */
    @PreAuthorize("@ss.hasPermi('TemuSalesData:TemuSalesData:add')")
    @Log(title = "TemuSalesData", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TemuSalesData temuSalesData)
    {
        return toAjax(temuSalesDataService.insertTemuSalesData(temuSalesData));
    }

    /**
     * 修改TemuSalesData
     */
    @PreAuthorize("@ss.hasPermi('TemuSalesData:TemuSalesData:edit')")
    @Log(title = "TemuSalesData", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TemuSalesData temuSalesData)
    {
        return toAjax(temuSalesDataService.updateTemuSalesData(temuSalesData));
    }

    /**
     * 删除TemuSalesData
     */
    @PreAuthorize("@ss.hasPermi('TemuSalesData:TemuSalesData:remove')")
    @Log(title = "TemuSalesData", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(temuSalesDataService.deleteTemuSalesDataByIds(ids));
    }
}
